package com.business.systemmanage.common.entity;

import lombok.Data;

/**
 * Created by xuguoyu on 2019/4/12.
 */
@Data
public class ResponseInfo {
    private int code;

    private static int SUCCESS_CODE = 200;
    private static int ERROR_CODE = 500;

    public static ResponseInfo generateSuccessRes() {
        return new ResponseInfo(SUCCESS_CODE, "success");
    }

    public static ResponseInfo generateErrorRes(String msg) {
        return new ResponseInfo(ERROR_CODE, msg);
    }

    public static ResponseInfo generateObjectRes(Object data) {
        return new ResponseInfo(SUCCESS_CODE, "success",data);
    }

    public ResponseInfo(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResponseInfo(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    private String msg;
    private Object data;
}
